/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package boundless.entities;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author hendrikdekock
 */
@Entity
@Table(name = "NFLTEAMS")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Nflteams.findAll", query = "SELECT n FROM Nflteams n"),
    @NamedQuery(name = "Nflteams.findById", query = "SELECT n FROM Nflteams n WHERE n.id = :id"),
    @NamedQuery(name = "Nflteams.findByName", query = "SELECT n FROM Nflteams n WHERE n.name = :name")})
public class Nflteams implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 100)
    @Column(name = "NAME")
    private String name;
    @Size(max = 4)
    @Column(name = "ABBR")
    private String abbr;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "nflteam")
    private Collection<Player> playerCollection;


    public Nflteams() {
    }

    public Nflteams(Integer id) {
        this.id = id;
    }

    public Nflteams(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @XmlTransient
    public Collection<Player> getPlayerCollection() {
        return playerCollection;
    }

    public void setPlayerCollection(Collection<Player> playerCollection) {
        this.playerCollection = playerCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Nflteams)) {
            return false;
        }
        Nflteams other = (Nflteams) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "boundless.entities.Nflteams[ id=" + id + " ]";
    }

}
